package tv.acgn.advertisement.publish.action;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import tv.acgn.advertisement.publish.exception.AbstractAdPubException;
import tv.acgn.advertisement.publish.service.AdUnitService;
import tv.acgn.advertisement.publish.service.CreativeService;
import tv.acgn.advertisement.publish.vo.creative.CreativeRequestVO;
import tv.acgn.advertisement.publish.vo.creative.CreativeResponseVO;
import tv.acgn.advertisement.publish.vo.creative.CreativeUnitRequestVO;
import tv.acgn.advertisement.publish.vo.creative.CreativeUnitResponseVO;

/**
 * @author : junG
 * @program : advertisement-ad-pub-action
 * @description : 创意分发器
 * @date : 2019-06-02 15:08
 **/

@RestController
public class CreativeAction {
    @Autowired
    private CreativeService creativeService;

    @Autowired
    private AdUnitService adUnitService;

    @PostMapping("/creative")
    public CreativeResponseVO add(CreativeRequestVO requestVO) throws AbstractAdPubException {
        return creativeService.addCreative(requestVO);
    }

    @PostMapping("/creative/unit")
    public CreativeUnitResponseVO add(CreativeUnitRequestVO requestVO) throws AbstractAdPubException {
        return adUnitService.addCreativeUnit(requestVO);
    }
}
